package com.allen.bill.service.impl;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Service;

import com.allen.bill.dao.NoteLossDAO;
import com.allen.bill.model.NoteLoss;
import com.allen.bill.service.NoteLossService;

@Service
public class NoteLossServiceImpl implements NoteLossService {

	private static final Logger logger = LoggerFactory
			.getLogger(NoteLossServiceImpl.class);
	@Autowired
	private NoteLossDAO noteLossDAO;
	 

	@Override
	public void saveNoteLoss(NoteLoss loss) {
		try {
			noteLossDAO.saveNoteLoss(loss);
		} catch (DataAccessException e) {
			logger.error("保存出错", e);
		}
	}


    @Override
    public void deleteNearData() {
        try {
            noteLossDAO.deleteNearData();
        } catch (DataAccessException e) {
            logger.error("删除出错", e);
        } 
    }


    @Override
    public void insertTransferData() {
        try {
            logger.info("删除字段为空的...");
            noteLossDAO.deleteBlank();
            logger.info("删除重复的...");
            noteLossDAO.deleteDistinct();
            logger.info("插入目标表...");
            noteLossDAO.inertDest();
        } catch (DataAccessException e) {
            logger.error("清洗出错", e);
        }
    }
	
	
	

}
